
import os

def ScanInDirs(directory:str) -> list[str]:
    """Scan all directories in the given directory."""
    if os.path.exists(directory) == False:
        raise FileNotFoundError(f"Directory {directory} not found.")
    result = []
    for dir in RangeInDirs(directory):
        result.append(dir)
    return result

def RangeInDirs(directory:str):
    """Range all files in the given directory."""
    if os.path.exists(directory) == False:
        raise FileNotFoundError(f"Directory {directory} not found.")
    root = os.path.abspath(directory)
    yield root
    for file in os.listdir(directory):
        # Ignore hidden files.
        if file.startswith("."):
            continue
        # Ignore files that are not directories.
        file_path = os.path.join(root, file)
        if os.path.isdir(file_path):
            yield file_path
